xen/vm-event: Remove unnecessary vm_event_domain indirection
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 31 May 2019 20:11:15 +0000 (13:11 -0700)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 Jun 2019 13:43:51 +0000 (14:43 +0100)
commit27a94e914f316ee7f88006b24a1c05fd434f671b
tree6de6889899393a60933ea540c5d667d29995ba28
parenta63f8f0672e6b9582f32b4ac61a595e5aea7ede7
xen/vm-event: Remove unnecessary vm_event_domain indirection

The use of (*ved)-> leads to poor code generation, as the compiler can't
assume the pointer hasn't changed, and results in hard-to-follow code.

For both vm_event_{en,dis}able(), rename the ved parameter to p_ved, and
work primarily with a local ved pointer.

This has a key advantage in vm_event_enable(), in that the partially
constructed vm_event_domain only becomes globally visible once it is
fully constructed.  As a consequence, the spinlock doesn't need holding.

Furthermore, rearrange the order of operations to be more sensible.
Check for repeated enables and an bad HVM_PARAM before allocating
memory, and gather the trivial setup into one place, dropping the
redundant zeroing.

No practical change that callers will notice.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
xen/common/vm_event.c